package com.appkubes.fintech.common.exption;

import com.appkubes.fintech.common.response.ResponseCode;

/**
 * @author Jiahong Chen
 * @date 2019/10/31
 */
public class BusinessException extends RuntimeException {

    private ResponseCode responseCode;

    public BusinessException() {
        super();
    }

    public BusinessException(ResponseCode responseCode) {
        super(responseCode.getMessage());
        this.responseCode = responseCode;
    }
    public BusinessException(String message) {
        super(message);
        this.responseCode = ResponseCode.FAIL;
    }

    public BusinessException(ResponseCode responseCode, String message) {
        super(message);
        this.responseCode = responseCode;
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
        this.responseCode = ResponseCode.FAIL;
    }

    public BusinessException(ResponseCode responseCode, String message, Throwable cause) {
        super(message, cause);
        this.responseCode = responseCode;
    }

    public BusinessException(Throwable cause) {
        super(cause);
        this.responseCode = ResponseCode.FAIL;
    }

    public BusinessException(ResponseCode responseCode, Throwable cause) {
        super(cause);
        this.responseCode = responseCode;
    }

    public BusinessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
    }

    public BusinessException(ResponseCode responseCode, String message, Throwable cause, boolean enableSuppression, boolean
            writableStackTrace) {
        super(message, cause, enableSuppression, writableStackTrace);
        this.responseCode = responseCode;
    }

    public ResponseCode getCode() {
        return responseCode;
    }

    public void setCode(ResponseCode responseCode) {
        this.responseCode = responseCode;
    }

}
